/***************************************************************************
 *                                                                         *
 *   This program is free software; you can redistribute it and/or modify  *
 *   it under the terms of the GNU General Public License as published by  *
 *   the Free Software Foundation; either version 2 of the License, or     *
 *   (at your option) any later version.                                   *
 *                                                                         *
 ***************************************************************************/
#ifndef gm4lin_H
#define gm4lin_H

#include <stdio.h>		/* standard i/o definitions */
#include <stdlib.h>		/* standard lib */
#include <math.h>		/* mathematical functions */
#include <string.h>		/* string function definitions */
#include <errno.h>		/* error number definition */
#include <unistd.h>		/* UNIX standard functions */
#include <signal.h>		/* signal management */
#include <syslog.h>		/* syslog message logging */
#ifdef SQL_LIBS
	//#include <mysql.h>		/* MySQL support */
	#include "/usr/include/mysql/mysql.h"
#endif
#ifdef GETTEXT
	#include <libintl.h>
	#define _(String) gettext(String)
	#define GETTEXT_CAT_DIR "/usr/share/locale"	/* base dir for messages files for the translations. They will be in GETTEXT_CAT_DIR/locale/CATEGORIE/DOMAINE.mo */
	#define GETTEXT_DOMAIN "gm4lin"	
#else
	#define _(String) String
#endif

#include "my_limits.h"
#include "structures.h"
#include "probe.h"
#include "initializations.h"
#include "acquisition.h"
#include "data_log.h"

/* software informations */
#define GM4LIN_NAME "Gm4lin"
#define GM4LIN_VERSION "v1.2.14"
#define GM4LIN_DATE "08/12/2008"
#define GM4LIN_AUTHOR "Mathias Bavay"
#define GM4LIN_AUTHOR_EMAIL "apbg4@free.fr"
#define GM4LIN_COMPANY "SLF"

/* sampling configuration */
#define INTEGRATION_RC 1.7			/* time constant of the numerical integration for the pulse mode */
#define SENSITIVITY_GM45_CO60 60		/* gm45 sensitivity: 60 cps/mR/h */
#define SENSITIVITY_GM10_CO60 15		/* gm10 sensitivity: xx cps/mR/h */
#define SENSITIVITY_GM10_CS137 21		/* gm10 sensitivity: xx cps/mR/h */
#define CALIBRATION 2				/* calibration factor for the detector in pulse mode */

/* run as a daemon */
#define DAEMON EXIT_FAILURE			/* EXIT_FAILURE for running as usual, EXIT_SUCCCESS for running as a daemon */

/* calibration */
#define events2cpm (60.0/ACTIVITY_DATA_WRITE_SAMPLING)					/* conversion factor to prevent re-calculating it every time in cpm_write */
#define events2mRh (ACTIVITY_DATA_WRITE_SAMPLING)					/* then, multiply by a Co60 sensitivity in cps/mR/h */
#define events2Rh (ACTIVITY_DATA_WRITE_SAMPLING*1000)					/* then, multiply by a Co60 sensitivity in cps/mR/h */
#define bicron_signal2mRh (INTEGRATION_RC*PULSE_DATA_WRITE_SAMPLING*CALIBRATION)	/* idem, for pulse recording */
#define bicron_signal2Rh (INTEGRATION_RC*PULSE_DATA_WRITE_SAMPLING*1000*CALIBRATION)	/* idem, for pulse recording */


#endif
